{include file="header"}
<body class="login-bg">
<div class="login">
    <div class="message">管理登录1</div>
    <div id="darkbannerwrap"></div>

    <form method="post" class="layui-form" >
        <input name="username" placeholder="用户名"  type="text" lay-verify="required" class="layui-input"  autocomplete="off">
        <hr class="hr15">
        <input name="password" lay-verify="required" placeholder="密码"  type="password" class="layui-input" autocomplete="off">
        <hr class="hr15">
        <input value="登录" lay-submit lay-filter="login" style="width:100%;" type="submit">
        <hr class="hr20" >
    </form>
    <script>
        $(function  () {
            layui.use('form', function(){
                var form = layui.form;
                //监听提交
                form.on('submit(login)', function(data){
                    layer.msg("正在登录...");
                    $.ajax({
                        type:"POST",                      //请求类型
                        url:"/index.php?s=backend/index/postlogin",                 //URL
                        data:data.field,                  //传递的参数
                        dataType:"json",                 //返回的数据类型
                        success:function(data){          //data就是返回的json类型的数据
                            //layer.msg(JSON.stringify(data));
                            if(data.code=="1"){
                                location.href='?s=backend/index/index';
                            }else{
                                layer.msg(data.msg,function(){
                                    window.location.reload();
                                });
                            }
                        },
                        error:function(data){
                        }
                    });
                    return false;
                });
            });
        });
        if (self!=top){
            window.top.location.replace(self.location); //打开自己网站的页面
        }
    </script>
</div>
</body>
{include file="footer"}